begin
  # In case you use Gosu via rubygems.
  require 'rubygems'
rescue LoadError
  # In case you don't.
end

require 'gosu'
include Gosu

require "debugout"
require "gameconfig"
require "game"


def main_restart(use_safe_options = false)
  $game.close
  if use_safe_options
    $check_keep_screen_dimensions = false
  else
    $check_keep_screen_dimensions = true
  end
  start(use_safe_options)
end

def start(use_safe_options = false)
  GameConfig.load_options
  if use_safe_options
    GameConfig["screen_width"], GameConfig["screen_height"], GameConfig["fullscreen"] = 800, 600, "No"
    GameConfig.save_options_to_file
  end
  $game = Game.new(GameConfig["screen_width"], GameConfig["screen_height"], GameConfig["fullscreen"] == "Yes")
  $game.show
end

start